<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            margin: 30px;
            border: 5px solid #000;
            padding: 20px;
            /* width: 200px;
            height: 100px; */
            /*box-sizing: border-box;   设置为IE模型*/
            /* box-sizing: content-box;  设置为标准盒模型*/
        }
    </style>
</head>

<body>
    <div id='wrap' style="width: 200px;height: 100px;">hello world</div>
    <script>
        let dom = document.getElementById('wrap')
        // dom.style.width=300+'px'//可以设置
        // console.log(dom.style.width);//可以获取行内样式的值-宽
        // dom.offsetWidth = 300 + 'px'//不能设置宽
        // console.log(dom.offsetWidth);//可以获取
        // dom.getBoundingClientRect().width=300+'px'//不能设置
        // console.log(dom.getBoundingClientRect().width)//获取几何图形的宽
//window.getComputedStyle(dom).width=300+'px'//不可设置
//console.log(window.getComputedStyle(dom).width)//可以获取计算样式下的一个宽
//console.log(dom.currentStyle.width)//获取浏览器渲染后的样式的宽，只支持IE
    </script>
</body>

</html>